home *** CD-ROM | disk | FTP | other *** search
- //
- // FlightRecorder
- //
- // an FKEY that will allow you to make a QuickTime movie of
- // your Leyte Gulf instant replay
- //
- // hard coded for FKEY 0
- // creates a PICS file, you need to use Movie Converter to make a
- // QuickTime movie
- // I started working on a QuickTime version, but did not complete it
- // look for it later on on your favorite net, or send me mail and I'll send it to ya
- //
- // Brigham Stevens
- // Apple Computer, Inc.
- // AppleLink: BRIGHAM
- // e-mail: brigham@apple.com
- // MacHack 1993
- //
- #include "FlightRecorder.h"
-
- pascal Boolean gneEntryPoint(short mask, EventRecord *evt);
- Boolean CurApIsLeyteGulf();
-
- main()
- {
-
- Handle code;
- register storage *s;
- CWindowPtr frontWindow;
-
- /* only run if there is a window */
- frontWindow = (CWindowPtr) FrontWindow();
- if(!frontWindow) return;
-
- /* If you are playing the old Hellcats */
- /* THEN UPGRADE! Leyte Gulf is only about 20 bucks */
- /* but it only works if you have Hellcats */
- if( CurApIsLeyteGulf() ) {
-
- /* Get a handle to us and make it stay */
- code = Get1Resource('FKEY',0);
- DetachResource(code);
- HNoPurge(code);
-
- s->code = code;
- s = GetStoragePtr();
-
- /* init the PICS file and save the first frame */
- StartRecording(s);
-
- /* patch GetNextEvent so we can copy each frame */
- /* inside SaveAFrame if the space bar is held down */
- /* then GNE is unpatched */
- s->gneLink = (long)GetToolTrapAddress(_GetNextEvent);
- SetToolTrapAddress( (long)StripAddress(gneEntryPoint), _GetNextEvent);
-
- }
- }
-
- Boolean CurApIsLeyteGulf()
- /*
- check for leyte gulf.
- compares CurApName with hard coded constants
- protects you from recording other apps accidently
- Get rid of this to record any app if you want.
- */
- {
- asm {
- move #0,d0 ; result to false
- movea.l #0x910,a0 ; curapname
- cmpi.l #lg1,(a0)+ ; look for _Ley
- bne @notIt
- cmpi.l #lg2,(a0)+ ; te G
- bne @notIt
- cmpi.w #lg3,(a0)+ ; ul
- bne @notIt
- cmpi.b #lg4,(a0) ; f
- move #1,d0 ; found it!
- @notIt
-
- }
- }
-
- // Events.h
-
-
-
- pascal Boolean gneEntryPoint(short mask, EventRecord *evt)
- {
-
- unsigned char keys[16];
- storage *s;
- CWindowPtr wp;
-
-
- s = GetStoragePtr();
- wp = (CWindowPtr)FrontWindow();
-
- SaveAFrame(s);
-
- GetKeys((void*)keys);
-
- if(IsPressed(0x31,keys)) {
- CloseResFile(s->ref);
- SetToolTrapAddress( s->gneLink, _GetNextEvent);
- HPurge(s->code);
- }
-
- // if this code passed throught here and called the real thing
- // then you could record the screen of any application
- // but it would be so slow that it just wouldn't be any fun
- }
-
-
-
-
- /* this is the block of memory used for static storage */
-
- storage *GetStoragePtr(void)
- {
- asm {
- bsr.s @skipStorage ; jump over all the storage space below
- DC.l 0x00 ; this also pushes the address of
- DC.l 0x00 ; the first byte of it on the stack
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- DC.l 0x00
- @skipStorage
- move.l (sp)+,d0 ; pop the address and return it
- }
- }